home *** CD-ROM | disk | FTP | other *** search
/ Treccani Italiana Di Scienze Lettere Ed Arti / [Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso / pc / data / xxi_appendice_dvd.swf / scripts / __Packages / mx / remoting / RsDataFetcher.as < prev    next >
Text File  |  2007-11-08  |  1KB  |  49 lines

  1. class mx.remoting.RsDataFetcher extends Object
  2. {
  3.    function RsDataFetcher(pgRS, increment)
  4.    {
  5.       super();
  6.       this.mRecordSet = pgRS;
  7.       this.mRecordSet.addEventListener("modelChanged",this);
  8.       this.mIncrement = increment;
  9.       this.mNextRecord = 0;
  10.       this.mEnabled = true;
  11.       this.doNext();
  12.    }
  13.    function disable()
  14.    {
  15.       this.mEnabled = false;
  16.    }
  17.    function doNext()
  18.    {
  19.       if(this.mEnabled)
  20.       {
  21.          while(true)
  22.          {
  23.             if(this.mNextRecord >= this.mRecordSet.getRemoteLength())
  24.             {
  25.                return undefined;
  26.             }
  27.             var _loc2_ = new mx.remoting.RsDataRange(this.mNextRecord,this.mNextRecord + this.mIncrement - 1);
  28.             this.mHighestRequested = this.mRecordSet.requestRange(_loc2_);
  29.             this.mNextRecord += this.mIncrement;
  30.             if(this.mHighestRequested > 0)
  31.             {
  32.                return undefined;
  33.             }
  34.          }
  35.       }
  36.    }
  37.    function modelChanged(eventObj)
  38.    {
  39.       if(eventObj.eventName == "updateItems" && eventObj.firstItem <= this.mHighestRequested && eventObj.lastItem >= this.mHighestRequested)
  40.       {
  41.          this.doNext();
  42.       }
  43.       if(eventObj.eventName == "allRows")
  44.       {
  45.          this.disable();
  46.       }
  47.    }
  48. }
  49.